//
//  ZLViewController.m
//  ZLCocoaKit
//
//  Created by itzhaolei on 12/05/2024.
//  Copyright (c) 2024 itzhaolei. All rights reserved.
//

#import "ZLViewController.h"
#import <ZLCocoaKit/ZLPushToast.h>

@interface ZLViewController ()

@end

@implementation ZLViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"🎆");
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    static NSInteger index = 0;
    index++;
    __block UIButton *button = UIButton.new;
    button.backgroundColor = UIColor.blackColor;
    button.layer.cornerRadius = 10;
    button.layer.masksToBounds = true;
    [button setTitle:[NSString stringWithFormat:@"测试：%ld", index] forState:(UIControlStateNormal)];
    button.contentEdgeInsets = UIEdgeInsetsMake(10, 15, 10, 15);
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [button removeFromSuperview];
    });
    
    ZLPushToast *view = [ZLPushToast push:button inView:self.view alignment:(ZLPushToastVerticalAlignmentBottom)];
    view.spacing = 20;
    view.contentInset = UIEdgeInsetsMake(100, 24, 100, 24);
}

@end
